{% comment %}
#    This file is part of OpenPolitik.
#
#    OpenPolitik is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    OpenPolitik is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with OpenPolitik.  If not, see <http://www.gnu.org/licenses/>.
{% endcomment %}
{% extends "layout.html" %}

{% block content %}
<script type = "text/javascript">
function checkForm(){
	$("error_msg").innerHTML = "";
	if ($("game_name").value.match(/^\s*$/)){
		$("error_msg").innerHTML += "You must have a game name.";
		return false;
	}
	return true;
}
</script>

{% if not errors|length_is:0 %}
	<p>There were some errors:<ul>
	{% for error in errors %}
		<li>{{ error }}</li>
	{% endfor %}
	</ul></p>
{% endif %}

<form action = "/create_game" method = "post" onsubmit = "return checkForm()">
	<p class = "last"><label>Game Name:</label><input name = "name" id = "game_name" maxlength = "32" /></p>
	<div id = "error_msg"></div>
	<p class = "last"><label>&nbsp;</label><input type = "submit" value = "Create" /></p>
</form>
{% endblock %}
